/**
 * Copyright &copy; 2016-2017 <a href="https://www.lczyfz.com">联创智云</a> All rights reserved.
 */
package com.lczyfz.campusinfo.modules.campusinfopay.service;

import java.util.List;

import com.lczyfz.campusinfo.common.enums.CampusinfoOrderStat;
import com.lczyfz.campusinfo.common.enums.OrderType;
import com.lczyfz.campusinfo.modules.sys.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lczyfz.campusinfo.common.persistence.Page;
import com.lczyfz.campusinfo.common.service.CrudService;
import com.lczyfz.campusinfo.modules.campusinfopay.entity.CampusinfoPay;
import com.lczyfz.campusinfo.modules.campusinfopay.dao.CampusinfoPayDao;

/**
 * 订单交易号Service
 * @author zms
 * @version 2018-05-28
 */
@Service
@Transactional(readOnly = true)
public class CampusinfoPayService extends CrudService<CampusinfoPayDao, CampusinfoPay> {
	@Autowired
	CampusinfoPayDao campusinfoPayDao;
	public CampusinfoPay get(String id) {
		return super.get(id);
	}
	
	public List<CampusinfoPay> findList(CampusinfoPay campusinfoPay) {
		return super.findList(campusinfoPay);
	}
	
	public Page<CampusinfoPay> findPage(Page<CampusinfoPay> page, CampusinfoPay campusinfoPay) {
		return super.findPage(page, campusinfoPay);
	}
	
	@Transactional(readOnly = false)
	public void save(CampusinfoPay campusinfoPay) {
		super.save(campusinfoPay);
	}
	@Transactional(readOnly = false)
	public void ordersave(CampusinfoPay campusinfoPay) {
		campusinfoPayDao.insert(campusinfoPay);
	}
	@Transactional(readOnly = false)
	public void ordersaveinsert(String OrderCode,String payMethod, String GoodName, String payment) {
		CampusinfoPay campusinfoPay = new CampusinfoPay();
		campusinfoPay.setId(OrderCode);//订单号
		campusinfoPay.setPaytype(payMethod); //支付方法
		campusinfoPay.setStat(CampusinfoOrderStat.UNDONE.getValue()); //支付状态 //默认状态为未完成
		campusinfoPay.setUser(UserUtils.getUser()); //用户名称
		campusinfoPay.setGoodsName(GoodName); //订单名称
		campusinfoPay.setAmount(payment);//费用
		campusinfoPayDao.insert(campusinfoPay);
	}
	@Transactional(readOnly = false)
	public void delete(CampusinfoPay campusinfoPay) {
		super.delete(campusinfoPay);
	}
	
}